<?php
/*
  Module Media Configuration
  
*/

register_module('media_files', array(
  'tab_name'=>'Media Files', 
  'tab_order'=>6,
  'class'=>'media'
  ));

register_module_controller('controller/media_index.php','Media Index');
register_module_controller('controller/media_download.php','Media Download');

function media_files_init(){
  if($_POST['PHPSESSID']!=''){
    $_POST['media_init'] = 'true';
    session_id( $_POST['PHPSESSID'] );
  }
}

add_action('init', 'media_files_init');


function media_files_form(){
  if(strpos($_POST['page_controller'], 'media_index.php') ===  false )return;
  
  
  $content .= '<div>Page Shortcode: <a href="#">media_list</a></div>';
  $content .='<h3>Media Files Index</h3>';
  $content .= '<fieldset>';
  $content .= '<div class="set"><label>List Media Category:</label>'. select_input('page_vars[media_category]', $_POST['page_vars']['media_category'], get_list_options('media_category',false)) .'</div>';
  $content .= '</fieldset>';
  return $content;
}

add_action('page_form_bottom', 'media_files_form');
?>